package com.weijianhuawen.wjblog.web.controller;

import com.weijianhuawen.wjblog.common.aspect.ApiOperationLog;
import com.weijianhuawen.wjblog.common.utils.Response;
import com.weijianhuawen.wjblog.web.mode.vo.user.FindUserInformationReqVo;
import com.weijianhuawen.wjblog.web.mode.vo.user.RegisterUserReqVo;
import com.weijianhuawen.wjblog.web.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @version: java version 8
 * @Author: weijianhuawen
 * @description:
 * @date: 2024-12-10 13:14
 */

@RestController
@RequestMapping("/user")
@Api(tags = "用户模块")
public class UserController {
    @Autowired
    private UserService userService;

    // 普通用户注册（非管理员用户）
    @PostMapping("/register")
    @ApiOperation(value = "用户注册")
    @ApiOperationLog(description = "注册普通用户")
    public Response registerOrdinaryUser(@RequestBody @Validated RegisterUserReqVo vo) {
        return userService.registerOrdinaryUser(vo);
    }

    // 获取用户后台信息
    @PostMapping("/information")
    @ApiOperation(value = "获取用户详细信息")
    @ApiOperationLog(description = "获取用户详细信息")
    public Response findUserDetailInformation(@RequestBody @Validated FindUserInformationReqVo vo) {
        return userService.findUserInformation(vo);
    }
}
